/*
 * Copyright (C) 2016 yixun All Rights Reserved.
 * 
 * MemberTypeEnum.java
 */
package com.emm.yixun.common.model.enums;

import java.io.Serializable;

import org.apache.commons.lang.StringUtils;

/**
 * [文件名称]<br>
 * ProjectInfo.java<br>
 * <br>
 * [文件描述]<br>
 * 房产项目信息 pojo bean<br>
 * <br>
 * [修改记录]<br>
 * 2016-05-11 11:27:20 创建<br>
 * 
 * @version 1.00
 */
public enum MemberTypeEnum implements Serializable {
	CUSTOMER_ADD("1", "家庭成员", null), DEPOSIT("2", "认筹客户", null), SUBSCRIBE("3", "认购客户", null), SIGNED("4", "签约客户", null), SIGNEDCHANGENAME(
			"5", "签约更名", null), SUBSCRIBECHANGENAME("6", "认购更名", null), Y_CUSTOMER_INFO("7", "原客户信息", null), N_CUSTOMER_INFO(
			"8", "新客户信息", null), Y_COMMON_INFO("9", "原共同购房者", null);

	private final String no;
	private final String des;
	private final Enum parent;

	/**
	 * 私有构造函数
	 * 
	 * @param code
	 * @param description
	 */
	MemberTypeEnum(String no, String des, Enum parent) {
		this.no = no;
		this.des = des;
		this.parent = parent;
	}

	/**
	 * @return Returns the no.
	 */
	public String getNo() {
		return no;
	}

	/**
	 * @return Returns the des.
	 */
	public String getDes() {
		return des;
	}

	/**
	 * @return Returns the parent.
	 */
	public Enum getParent() {
		return parent;
	}

	/**
	 * 通过枚举<code>des</code>获得枚举
	 * 
	 * @param des
	 * @return
	 */
	public static MemberTypeEnum getByDescription(String des) {
		if (StringUtils.isBlank(des)) {
			return null;
		}
		for (MemberTypeEnum menum : values()) {
			if (menum.getDes().equals(des)) {
				return menum;
			}
		}
		return null;
	}

	public static MemberTypeEnum getByNo(String no) {
		if (StringUtils.isBlank(no)) {
			return null;
		}
		for (MemberTypeEnum menum : values()) {
			if (menum.getNo().equals(no)) {
				return menum;
			}
		}
		return null;
	}
}
